home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 15
/
015.d81
/
a mazing grace
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
3KB
|
122 lines
100 rem a mazing grace
110 rem by george trepal
120 :
130 poke 56,23:poke 55,215:poke 650,128
140 dn$="": pf=0:rem printer flag
144 print"[147]do you have a printer ?";
145 poke198,0:wait198,1:getk$: ifk$<>"y"andk$<>"n"then147
146 printk$
148 ifk$="y"thenpf=1
149 :
150 gosub1000
160 poke53281,0 :poke53280,11: print"[147]"
170 direc(0)=2:direc(1)=-80:direc(2)=-2:direc(3)=80
180 wall=160:poke 2,wall: path=32
190 j=rnd(-ti)
200 gosub360
210 rem draw maze
220 sp$ = "[159]++++++++++++++++++++++++++++++++++++++++"
230 print"[147]";: for j=1 to 26: print sp$;: next
240 printdn$;" [153]>>>>>>>>>>>> [158]drawing maze [153]<<<<<<<<<<<<";
250 now=int(rnd(1)*4):current=now
260 look = hereiam + direc(now)
270 if peek(look)=wall then330
280 now=(now+1): if now>3 then now=0
290 if now<>current then260
300 now=peek(hereiam):poke hereiam,path:gosub930
310 if now<4 then hereiam=hereiam-direc(now): goto250
320 goto560
330 pokelook,now:poke hereiam+direc(now)/2,path: hereiam=look:gosub930
340 goto250
350 rem user input
360 sa = 6144
370 printspc(11)"[147] giant maze printer"
380 printspc(12)"by george trepal"
390 input" (odd) number of lines (0=exit)";nl:ifnl=0then63000
400 ifnl/2=int(nl/2) then print "odd numbers only!": goto390
410 if nl>649 then print "too many lines!": goto390
412 ifnl<5ornl>670thenprint"not a good sized maze..":fordl=1to1000:next:goto390
420 print" approximate production time is";int(nl/15*10)/10;"min"
440 print " print <1> normal, <2> double or <3>"
450 input " triple length maze";flag
460 if fl<1 or fl>3 then440
470 ea = nl * 40 + sa - 1
480 printspc(10)"conditioning memory"
490 sys 49227
500 forj = sa - 40 to sa + 39: poke j,102:next
510 for j = ea - 40 to ea + 40: poke j,102: next
520 for j = sa-1 to ea step 40: poke j,32: next
530 hereiam = sa + 77
540 return
550 rem finish wall
560 forj = sa to sa + 38: poke j,wall: next: gosub930
570 for j = ea - 39 to ea-1: poke j,wall: next: gosub930
580 poke sa+1,32
590 poke ea-2,32
600 ifpf=1thenprintdn$;" u=up d=down p=print x=exit ";
602 ifpf=0thenprintdn$;" u=up d=down x=exit ";
603 :
610 goto800
620 rem output to printer
630 open4,4: cmd4: f2 = 1
640 rem print maze
650 tp = sa:for j = 1 to nl: gosub800
660 for k = sa to sa + 38
670 pk = peek (k): if pk = wall then pk = 35
680 m$ = m$ + chr$(pk) + chr$(pk)
690 next
700 m$=" " + m$
710 for tm = 1 to flag
720 print#4, m$
730 next
740 m$ = "": sa = sa +40
750 next
760 print#4, " ": close 4
770 sa=tp: f2 = 0
780 get a$:if a$<>"" then780
790 rem show maze
800 ps=sa:goto860
810 geta$:ifa$=""then810
812 ifa$="x"then360
820 ifa$="u"thenps=ps+40:goto860
830 ifa$="d"thenps=ps-40:goto860
840 ifpf=1thenifa$="p"then630
850 goto810
860 h=int(ps/256)
870 l=ps-h*256
875 ifl<0thenl=0
876 ifh<0thenh=0
877 ifl>255thenl=255
878 ifh>255thenh=255
880 poke251,l: poke252,h
890 sys49153
900 if f2 = 1 then return
910 goto810
920 rem fill memory w1th wall
930 mp=int((hereiam-sa)/40)*40-440
940 mp=sa + mp
950 hp = int(mp/256)
960 lp = mp - 256*hp
970 poke251,lp: poke252,hp
980 sys49153:return
990 rem machine language
1000 print "[147]": ad = 49152
1010 read x: if x = -1 then return
1020 poke ad,x: ad = ad + 1
1030 goto1010
1040 data234,234,234,169,0,133,253,169,4,133
1050 data254,169,0,141,0,192,160,0,162,0
1060 data177,251,145,253,24,165,251,105,1,133
1070 data251,165,252,105,0,133,252,24,165,253
1080 data105,1,133,253,165,254,105,0,133,254
1090 data232,208,223,234,238,0,192,173,0,192
1100 data201,4,208,1,96,201,3,208,205,162
1110 data64,76,20,192,234,169,0,133,251,169
1120 data24,133,252,160,0,165,2,145,251,200
1130 data208,251,230,252,165,252,201,126,208,241
1140 data96,-1
63000 rem connect to l.s.
63005 poke56,160:poke55,0:poke650,0
63010 print"[147]load"chr$(34)"payload" chr$(34)",8":print"run"
63020 poke631,13:poke632,13:poke198,2: end